#include <iostream>
#include <cmath>
#include <allegro.h>

using namespace std;

int main()
{
    float x1=0,x2=0,y1=0,y2=0,n;
    float i=0,sum=0,dis=0,avdis=0;
    cout<<"Enter the number of strips\t";
    cin>>n;

    allegro_init();
    install_keyboard();
    set_gfx_mode(GFX_AUTODETECT_WINDOWED,600,600,0,0);
    clear_to_color(screen,makecol(255,255,255));
    x1=rand();
    y1=rand();
    circle(screen,x1,y1,10,makecol(0,0,0));
    sum=0;
    for(i=0;i<n;i++)
    {
        x1=rand();
        x2=rand();
        dis=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
        line(screen,x1,y1,x2,y2,makecol(0,0,0));
        circle(screen,x2,y2,10,makecol(0,0,0));
        sum=sum+10;
        x1=x2;
        y1=y2;
    }
    readkey();
    avdis=sum/n;
    cout<<"Mean free path="<<avdis;
}
END_OF_MAIN()
